﻿<Window x:Class="SharpestBeak.UI.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:cmd="clr-namespace:SharpestBeak.UI.Commands" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        xmlns:local="clr-namespace:SharpestBeak.UI" mc:Ignorable="d" Title="MainWindow" MinWidth="600"
        MinHeight="400" FontFamily="{StaticResource DefaultFontFamily}" FontSize="{StaticResource DefaultFontSize}"
        WindowStartupLocation="CenterScreen" Loaded="MainWindow_OnLoaded">
    <Window.CommandBindings>
        <CommandBinding Command="cmd:AppCommands.Play" CanExecute="CanExecutePlay" Executed="ExecutePlay" />
        <CommandBinding Command="cmd:AppCommands.Exit" CanExecute="CanExecuteExit" Executed="ExecuteExit" />
        <CommandBinding Command="cmd:AppCommands.DefaultPreset" CanExecute="CanExecuteDefaultPreset"
                Executed="ExecuteDefaultPreset" />
        <CommandBinding Command="cmd:AppCommands.SmallPreset" CanExecute="CanExecuteSmallPreset"
                Executed="ExecuteSmallPreset" />
        <CommandBinding Command="cmd:AppCommands.MediumPreset" CanExecute="CanExecuteMediumPreset"
                Executed="ExecuteMediumPreset" />
        <CommandBinding Command="cmd:AppCommands.LargePreset" CanExecute="CanExecuteLargePreset"
                Executed="ExecuteLargePreset" />
        <CommandBinding Command="cmd:AppCommands.ExtraLargePreset" CanExecute="CanExecuteExtraLargePreset"
                Executed="ExecuteExtraLargePreset" />
    </Window.CommandBindings>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Menu Grid.Row="0">
            <MenuItem Name="GameMenuItem" Header="_Game">
                <MenuItem Name="PlayMenuItem" Command="{x:Static cmd:AppCommands.Play}" />
                <Separator />
                <MenuItem Name="ExitMenuItem" Command="{x:Static cmd:AppCommands.Exit}" />
            </MenuItem>
            <Separator />
            <MenuItem Name="PresetMenuItem" Header="_Preset">
                <MenuItem Name="DefaultPresetMenuItem" Command="{x:Static cmd:AppCommands.DefaultPreset}" />
                <Separator />
                <MenuItem Name="SmallPresetMenuItem" Command="{x:Static cmd:AppCommands.SmallPreset}" />
                <MenuItem Name="MediumPresetMenuItem" Command="{x:Static cmd:AppCommands.MediumPreset}" />
                <MenuItem Name="LargePresetMenuItem" Command="{x:Static cmd:AppCommands.LargePreset}" />
                <MenuItem Name="ExtraLargePresetMenuItem" Command="{x:Static cmd:AppCommands.ExtraLargePreset}" />
            </MenuItem>
        </Menu>

        <xctk:PropertyGrid Grid.Row="1" Name="GameSettingPropertyGrid" HorizontalAlignment="Stretch"
                VerticalAlignment="Stretch" AutoGenerateProperties="True" ShowSearchBox="False"
                ShowSortOptions="False" ShowSummary="False" IsCategorized="False" ShowTitle="False">
            <xctk:PropertyGrid.SelectedObject>
                <local:GameSettings x:Name="CurrentGameSettings" />
            </xctk:PropertyGrid.SelectedObject>
            <xctk:PropertyGrid.EditorDefinitions>
                <xctk:EditorTemplateDefinition TargetProperties="{x:Type local:SizeObject}">
                    <xctk:EditorTemplateDefinition.EditingTemplate>
                        <DataTemplate>
                            <TextBlock d:DataContext="{d:DesignInstance Type=xctk:PropertyItem}"
                                    Text="{Binding Path=Value.(local:SizeObject.AsString)}" />
                        </DataTemplate>
                    </xctk:EditorTemplateDefinition.EditingTemplate>
                </xctk:EditorTemplateDefinition>
                <xctk:EditorTemplateDefinition TargetProperties="{x:Type local:TeamSettings}">
                    <xctk:EditorTemplateDefinition.EditingTemplate>
                        <DataTemplate>
                            <TextBlock d:DataContext="{d:DesignInstance Type=xctk:PropertyItem}"
                                    Text="{Binding Path=Value.(local:TeamSettings.AsString)}" />
                        </DataTemplate>
                    </xctk:EditorTemplateDefinition.EditingTemplate>
                </xctk:EditorTemplateDefinition>
            </xctk:PropertyGrid.EditorDefinitions>
        </xctk:PropertyGrid>
    </Grid>
</Window>